package com.econ.powercloud.ems.common.enums;

/**
 * @Author : zjf
 * @Description : PCU/PCS状态枚举
 * @Date : 2022/4/11 8:32
 * @Modified by : zjf
 */
public enum PcsOrPcuRunStatus implements EnumMethod {

    SHUT(1,"停机"),
    STANDBY(2,"待机"),
    RUN(3,"运行"),
    CHARGE(4,"充电"),
    DISCHARGE(5,"放电"),
    UNKNOWN(100,"未知");

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }


    PcsOrPcuRunStatus(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static PcsOrPcuRunStatus fromCode(int code){
        for(PcsOrPcuRunStatus type: PcsOrPcuRunStatus.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }
}
